home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / incoming / jstools-.6v3 / jstools- / jstools-tk3.6v3.0 / lib / jfileio.tcl < prev    next >
Encoding:
Text File  |  1995-02-05  |  869 bĀ   |  29 lines

  1. # jfileio.tcl - read and write text to files
  2. # Copyright 1994 by Jay Sekora.  All rights reserved, except 
  3. # that this file may be freely redistributed in whole or in part 
  4. # for nonĀ”profit, noncommercial use.
  5. ######################################################################
  6.  
  7. ######################################################################
  8. # write given text to a file
  9. ######################################################################
  10.  
  11. proc j:fileio:write { filename text } {
  12.   set file [open $filename w]
  13.   puts -nonewline $file $text
  14.   close $file
  15. }
  16.  
  17. ######################################################################
  18. # return contents of file
  19. ######################################################################
  20.  
  21. proc j:fileio:read { filename } {
  22.   set file [open $filename r]
  23.   set result [read $file]
  24.   close $file
  25.   
  26.   return $result
  27. }
  28.